
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Package pgfplots.sty documentation.
%
% Copyright 2007/2008 by Christian Feuersaenger.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\usepackage{makeidx}

% DON't let hyperref overload the format of index and glossary.
% I want to do that on my own in the stylefiles for makeindex...
\makeatletter
\let\@old@wrindex=\@wrindex
\makeatother

\usepackage{ifpdf}
\usepackage[pdfborder=0 0 0]{hyperref}
    \hypersetup{%
        colorlinks=true,    % use true to enable colors below:
        linkcolor=blue,%red,
        filecolor=blue,%magenta,
        %pagecolor=blue,%red,
        urlcolor=blue,%cyan,
        citecolor=blue,
        %frenchlinks=false,    % small caps instead of colors
        pdfborder=0 0 0,    % PDF link-darstellung, falls colorlinks=false. 0 0 0: nix. 0 0 1: default.
        %plainpages=false,    % Das ist notwendig, wenn die Seitenzahlen z.T. in Arabischen und z.T. in römischen Ziffern gemacht werden.
        pdftitle=Package PGFPLOTS manual,
        pdfauthor=Dr. Christian Feuersänger,
        %pdfsubject=,
        pdfkeywords={pgfplots pgf tikz tex latex},
    }

\makeatletter
\let\@wrindex=\@old@wrindex
\makeatother

\date{\small{Revision \pgfplotsrevision\space (\pgfplotsrevisiondate)}}

\usepackage{pdftexcmds}

\usepackage{luatex85}

\makeatletter
% disables colorlinks for all following \ref commands
\def\pgfplotsmanualdisablecolorforref{%
    \pgfutil@ifundefined{pgfplotsmanual@oldref}{%
        \let\pgfplotsmanual@oldref=\ref
    }{}%
    \def\ref##1{%
        \begingroup
        \let\Hy@colorlink=\pgfplots@disabled@Hy@colorlink
        \let\Hy@endcolorlink=\pgfplots@disabled@Hy@endcolorlink
        \pgfplotsmanual@oldref{##1}%
        \endgroup
    }%
}%
\def\pgfplots@disabled@Hy@colorlink#1{\begingroup}%
\def\pgfplots@disabled@Hy@endcolorlink{\endgroup}%
\makeatother

% Formatiere Seitennummern im Index:
\newcommand{\indexpageno}[1]{%
    {\bfseries\hyperpage{#1}}%
}

\def\C{\mathbb{C}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}

\long\def\COMMENTLOWLEVEL#1\ENDCOMMENT{}
\def\ENDCOMMENT{}

\usepackage{textcomp}
\usepackage{booktabs}

\usepackage{calc}
\usepackage[formats]{listings}
%\usepackage{courier} % don't use it -- the '^' character can't be copy-pasted in courier

\usepackage{array}
\lstset{%
    basicstyle=\ttfamily,
    language=[LaTeX]tex, % Seems as if \lstset{language=tex} must be invoked BEFORE loading tikz!?
    tabsize=4,
    breaklines=true,
    breakindent=0pt,
}

\ifpdf
%    \pdfinfo {
%        /Author    (Christian Feuersaenger)
%    }

\else
%    \def\pgfsysdriver{pgfsys-dvipdfm.def}
\fi
%\def\pgfsysdriver{pgfsys-pdftex.def}
\usepackage{pgfplots}
\usepackage{pgfplotstable}

\ifpdf
    % this allows to disable the clickable lib from command line using
    % \pdflatex '\def\pgfplotsclickabledisabled{1}\input{pgfplots.tex}'
    \expandafter\ifx\csname pgfplotsclickabledisabled\endcsname\relax
        \usepgfplotslibrary{clickable}
    \fi
\fi

%\usepackage{fp}
% ATTENTION:
% this requires pgf version NEWER than 2.00:
%\usetikzlibrary{fixedpointarithmetic}

\usepgfplotslibrary{dateplot,units,groupplots,statistics}

\pgfplotsset{
    table/search path={.,plotdata}
}

\usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{xxcolor}

\usepackage{ifluatex}

% tlmgr install zapfding symbol
\usepackage{pifont}

\def\lua{\textsc{lua}}

\ifluatex
    %\usepackage[utf8]{luainputenc}
\else
    \usepackage[latin1]{inputenc}
\fi
\usepackage{amsmath}

% tlmgr eurosym
\usepackage{eurosym}

% tlmgr install units
\usepackage{nicefrac}
\input{pgfplots-macros}

\makeatletter
\@ifpackageloaded{tex4ht}{
}{%
    \IfFileExists{ocg.sty}{%
        \usepackage{ocg}%
    }{%
        \usepackage{pgfplots_ocg_copy}%
    }
}%
\makeatother

\usepackage{nicefrac}

\graphicspath{{figures/}}

\edef\preambleconfig{width=7cm,compat=\pgfkeysvalueof{/pgfplots/compat/mostrecent}}

% generate the following file such that it does not need to be updated
% manually for each release:
\makeatletter
\immediate\openout\w@pgf@writea pgfplots.preliminaries.compatcurrent.tmp
\immediate\write\w@pgf@writea{%
\string\begin{codeexample}[code only]^^J%
\string\usepackage{pgfplots}^^J%
\string\pgfplotsset{compat=\pgfkeysvalueof{/pgfplots/compat/mostrecent}}^^J%
\string\end{codeexample}%
}%
\immediate\closeout\w@pgf@writea


\expandafter\pgfplotsset\expandafter{\preambleconfig}

\pgfplotsset{lua debug=off and silent}

\def\pgfplotsmanualcurlibrary{}

% And now, invoke
%     /codeexample/typeset listing/.add={% Preamble:\pgfplotsset{\preambleconfig}}{}}
% since listings are VERBATIM, I need to do some low-level things
% here to get the correct \catcodes:
\pgfkeys{/codeexample/typeset listing/.add code={%
        \ifcode@execute
            \begingroup
            \def\b@show@header{0}%
            \pgfutil@in@{axis}{#1}%
            \ifpgfutil@in@
                \def\b@show@header{1}%
            \fi
            %
            \pgfutil@in@{addplot}{#1}%
            \ifpgfutil@in@
                \def\b@show@header{1}%
            \fi
            %
            \pgfutil@in@{smithchart}{#1}%
            \ifpgfutil@in@
                \def\b@show@header{1}%
            \fi
            \if1\b@show@header
                {\tiny
                    \% Preamble: \pgfmanualpdfref{\textbackslash pgfplotsset}{\pgfmanual@pretty@backslash pgfplotsset}%
                        \pgfmanual@pretty@lbrace \expandafter\pgfmanualprettyprintpgfkeys\expandafter{\preambleconfig}\pgfmanual@pretty@rbrace
                        \ifx\pgfplotsmanualcurlibrary\pgfutil@empty
                        \else
                            \pgfmanual@pretty@backslash usepgfplotslibrary\pgfmanual@pretty@lbrace \pgfplotsmanualcurlibrary\pgfmanual@pretty@rbrace
                        \fi
                }%
            \fi
            \endgroup
        \fi
    }{},%
    %/codeexample/typeset listing/.show code,
}%
\makeatother

\pgfplotsset{
    %every axis/.append style={width=7cm},
    filter discard warning=false,
}

\pgfqkeys{/codeexample}{%
    every codeexample/.append style={
        width=8cm,
        /pgfplots/legend style={fill=graphicbackground},
        /pgfplots/contour/every contour label/.append style={
            every node/.append style={fill=graphicbackground}
        },
    },
    tabsize=4,
}

\usetikzlibrary{backgrounds,patterns}
% Global styles:
\tikzset{
  shape example/.style={
    color=black!30,
    draw,
    fill=yellow!30,
    line width=.5cm,
    inner xsep=2.5cm,
    inner ysep=0.5cm}
}

\newcommand{\FIXME}[1]{\textcolor{red}{(FIXME: #1)}}

% fuer environment 'sidewaysfigure' bspw
% \usepackage{rotating}

\newcommand\Tikz{Ti\textit kZ}
\newcommand\PGF{\textsc{pgf}}
\newcommand\PGFPlots{\pgfplotsmakefilelinkifuseful{pgfplots}{\textsc{pgfplots}}}
\newcommand\PGFPlotstable{\pgfplotsmakefilelinkifuseful{pgfplotstable}{\textsc{PgfplotsTable}}}

\makeindex

% Fix overfull hboxes automatically:
\tolerance=2000
\emergencystretch=10pt

\tikzset{prefix=gnuplot/pgfplots_} % prefix for 'plot function'

\author{%
    Dr.\ Christian Feuersänger\\
    {\footnotesize\texttt{cfeuersaenger@users.sourceforge.net}}}%


\usepackage{todonotes}
\newcommand\todosp[2][]{%        % Stefan Pinnow
    \todo[
        disable,
        color=blue!40,
        #1]{#2}
}
